﻿using DemountCIM.Framework.DataBase.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFDataBase;

namespace DemountCIM.Framework.DataBase
{
    public interface IParameterRepository : IBaseRepository<TbParameter>
    {
        /// <summary>
        /// 初始化参数
        /// </summary>
        /// <param name="runId">模组ID</param>
        /// <param name="key"></param>
        /// <param name="name">label</param>
        /// <param name="description">描述</param>
        /// <param name="paraType"></param>
        /// <param name="paraLevel"></param>
        /// <param name="readOnly"></param>
        /// <param name="visible"></param>
        void InsertPrivateParam(int runId, string key, string name, string description, ParamType paraType, UserLevel paraLevel = UserLevel.操作工, bool readOnly = false, bool visible = true);

        /// <summary>
        /// 获取该模组所有参数
        /// </summary>
        /// <param name="runId"></param>
        /// <returns></returns>
        List<TbParameter> GetAllParameters(int runId);

        bool ReadBool(string paramKey, bool defaultValue);

        string ReadString(string paramKey, string defaultValue);

        int ReadInt(string paramKey, int defaultValue);

        bool WriteBool(int runId, string paramKey, bool value);

        bool WriteString(int runId, string paramKey, string value);

        bool WriteInt(int runId, string paramKey, int value);
    }
}
